package com.letv.core.constant;

import android.os.Environment;

public class DownloadConstant {
    /** 乐视视频存储路径 **/
    public static final String PATH = "Letv/storage/";
    /** 乐视视频下载目录 **/
    public static final String PATH_DOWNLOAD = PATH + "download";
    public static final String DOWNLOAD_LOCATION_KEY = "download_location";
    public static final String DOWNLOAD_LOCATION_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + PATH_DOWNLOAD;
    
    
    public static final long SIZE_KB = 2 << 9;
    public static final long SIZE_MB = (long) (1024 * 1024.0);
    public static final long SIZE_GB = (long) (1024 * 1024 * 1024.0);
    
    /**
     * 通知action
     */
    public static final String NOTIFY_INTENT_ACTION = "com.letv.android.client.worldcup.download";

    /**
     * 广播页面显示通知action
     */
    public static final String NOTIFY_INTENT_ACTION_TO_CLIENT = "com.letv.android.client.worldcup.download.action_update";

    /**
     * 广播返回数据字段定义
     */
    public final static String NOTIFY_DOWNLOAD_KEY_EPISODEID = "episodeId";
    public final static String NOTIFY_DOWNLOAD_KEY_PROGRESS = "progress";
    public final static String NOTIFY_DOWNLOAD_KEY_STATUS = "status";
    public final static String NOTIFY_DOWNLOAD_KEY_TYPE = "type";

    /**
     * 下载数量限制
     */
    public static int DOWNLOAD_JOB_NUM_LIMIT = 1;

    /**
     * 下载文件启动线程限制（文件最大分段数）
     */
    public static int DOWNLOAD_JOB_THREAD_LIMIT = 3;
    /**
     * wifi状态键名
     */
    public final static String KEY_DOWNLOAD_JOB_WIFI_STATE = "wifistate";
    public final static String KEY_DOWNLOAD_JOB_IS_WIFI = "iswifi";
    /**
     * wifi状态类型沿用常量值 4
     */
    public final static int TYPE_DOWNLOAD_JOB_WIFI_STATE = 4;
    /**
     * 通知服务控制信号量
     */
    public final static String KEY_NOTIFICATION_SERVICE_ACTION = "action";
    public final static int TYPE_NOTIFICATION_SERVICE_STOP = 0;
    public final static int TYPE_NOTIFICATION_SERVICE_START = 1;
    
    /**
     * 缓存下载界面标识
     */
    public static final int DOWNLOAD_STATE_FINISH = 0;
    public static final int DOWNLOAD_STATE_DOWNLOADING = 1;
    public static final int DOWNLOAD_STATE_LOCAL = 2;
    public static final int DOWNLOAD_STATE_WORLDCUP = 3;

    /**
     * 下载正式地址
     */
    public static final String DYNAMIC_APP_BASE_URL = "http://dynamic.app.m.letv.com/android/dynamic.php";

    /**
     * 下载测试地址
     */
    public static final String TEST_BASE_URL = "http://test2.m.letv.com/android/dynamic.php";

    /**
     * service传递参数key
     * 
     * @author liang
     * 
     */
    public class ServiceParams {
        public static final String KEY_ID = "id";
        public static final String KEY_URL = "url";
        public static final String KEY_FILE_DIR = "directory";
        public static final String KEY_FILE_NAME = "file_name";
        public static final String KEY_THREADS = "threads";
        // for letv
        // public static final String KEY_LISTENER = "listener";
        public static final String KEY_MMSID = "mmsid";
        public static final String KEY_ISHD = "ishd";
        public static final String KEY_PCODE = "pcode";
        public static final String KEY_VERSION = "version";
        //
        public static final String KEY_IS_ERROR = "isError";
    }

    /**
     * 广播传递参数key和常量
     * 
     * @author lihui3
     * 
     * 名称待修正
     * 添加message信号量
     * 
     */
    public class BroadcaseIntentParams {
        public static final int PROCESS = 0;
        public static final int COMPLETE = 1;
        public static final int START = 2;
        public static final int PAUSE = 3;
        public static final int DELETE = 4;
        public static final int CONTINUE = 5;
        public static final int ADD = 6;
        public static final int STOP = 7;
        public static final int PENDING = 8;
        public static final int ERROR = 9;
        public static final int PAUSE_USER = 10;
        public static final int DELETEALL = 11;

        public static final String KEY_TYPE = "type";

        public static final String KEY_ID = "id";
        public static final String KEY_URL = "url";
        public static final String KEY_STATUS = "status";
        public static final String KEY_DOWNLOADED = "downloaded";// 已经下载数据值
        public static final String KEY_DOWNLOADED_STR = "downloaded_str";// 已经下载数据值（文本值）
        public static final String KEY_TOTAL = "total";// 总数据值
        public static final String KEY_TOTAL_STR = "total_str";// 总数据值（文本值）
        public static final String KEY_SPEED = "speed";
        public static final String KEY_PROGRESS = "progress";
        
        //message 信号量
        //通知栏进度更新
        public static final int MESSAGE_UPDATE_DOWNLOAD_PROGRESS = 1010;
    }
}